﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div style="width: 100%;">
    <div class="mini-toolbar" style="border-bottom: 0; padding: 0px;">
        <table style="width: 100%;">
            <tr>
                <td style="width: 100%;">
                    <a id="add" class="mini-button" iconcls="icon-node" plain="true" onclick="CheckSign()">签收</a>
                </td>
                <td style="white-space: nowrap;">
                     发货地<input id="StartCity" class="mini-textbox"  style="width: 100px;" onenter="onKeyEnter" />
                    收货地<input id="EndCity" class="mini-textbox"  style="width: 100px;" onenter="onKeyEnter" />
                    货物编号<input id="key" class="mini-textbox" emptytext="" style="width: 100px;" onenter="onKeyEnter" />
                    <a class="mini-button" plain="true" onclick="search()">查询</a>
                </td>
            </tr>
        </table>
    </div>
</div>

<div class="mini-fit" style="height: 100%;">
    <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%;"
        url="GetOrderList"  pagesize="20"
        allowcelledit="true" allowcellselect="true" multiselect="true"
        editnextonenterkey="true" editnextrowcell="true">
        <div property="columns">
            <div type="indexcolumn"></div>
            <div type="checkcolumn"></div>
             <div field="TicketNum"  headeralign="center" >
                货运单号
            </div>
             <div field="StartCity"  headeralign="center" >
                发货地
            </div>
            <div field="EndCity"  headeralign="center" >
                收货地
            </div>
             <div field="SenderName"  headeralign="center" >
                发货人
            </div>
            <div field="ReceiverName"  headeralign="center" >
                收货人
            </div>
            <div field="StatusName" headeralign="center" >
                状态
            </div>	
            <div field="GoodsName"  headeralign="center" >
                货物名称
            </div>
            <div field="Quantity" headeralign="center" >
                件数
            </div>	
             <div name="Details" width="40" allowsort="true">详细</div>
        </div>
    </div>
</div>


<script type="text/javascript">

    mini.parse();

    var grid = mini.get("datagrid1");
    grid.load({
        fail: function () {
        }
    });

    function search() {
        var key = mini.get("key").getValue();
        var StartCity = mini.get("StartCity").getValue();
        var EndCity = mini.get("EndCity").getValue();

        grid.load({
            key: key, StartCity: StartCity, EndCity: EndCity, fail: function () {
            }
        });
    }

    function onKeyEnter(e) {
        search();
    }
    grid.on("drawcell", function (e) {
        var record = e.record,
            column = e.column,
            field = e.field,
            value = e.value;
        if (column.name == "Details") {
            e.cellStyle = "text-align:left";
            e.cellHtml = "<a href=\"javascript:OpenOrderDetail('" + record.GoodsOrderID + "')\">详细</a>";
        }
    }
    );

    function OpenOrderDetail(GoodsOrderID) {
        var win = mini.open({
            url: "/BusinessData/Arrived/OrderDetail?GoodsOrderID=" + GoodsOrderID,
            title: "详细", width: screen.width * 0.9, height: screen.height * 0.7,
            iconCls: "icon-createNews",
            showMaxButton: true,
            onload: function () {
            },
            ondestroy: function (action) {
                grid.reload();
            }
        });
        //win.max();
    }

</script>

